home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
batch
/
ask.zip
/
ASK.DOC
next >
Wrap
Text File
|
1988-01-15
|
2KB
|
56 lines
Ask is a batch enhancement program that allows you to prompt a user and read a
response on the same line. It then translates the user response into an
ERRORLEVEL code that can be used to perform different functions in batch files.
Example:
ECHO Please enter one of the following:
ECHO.
ECHO A. Start word processor
ECHO B. Start spreadsheet
ECHO C. Start database
ECHO.
ask "Please enter A, B, or C -> " ABC
IF ERRORLEVEL 3 GOTO C
IF ERRORLEVEL 2 GOTO B
IF ERRORLEVEL 1 GOTO A
Only characters in the response string (ABC in the example above) are
recognized. If the user tries to enter another character, Ask will beep
and wait for a character in the list.
The characters in the response (ABC) above are not limited to letters. Digits
or special characters may be used. Only a single character is recognized in a
response. Any of the 255 ASCII characters may be used, except that no
distinction is made between uppercase and lowercase letters. Function keys,
arrow keys, Alt and Ctrl keys are not recognized.
ERRORLEVEL is set to the position of the user's response in the character
string. Thus, if the string is "ABC" and the user types "B", ERRORLEVEL will
be set to 2. But if the string is "BCA" and the user types "B", ERRORLEVEL
will be set to 1. (abc, ABC, B, b would all produce the same result in these
examples.)
Remember in a batch file that the test
IF ERRORLEVEL n statement
is interpreted as
IF ERRORLEVEL >= n statement
so be sure that your IFs test the numbers in descending order.
Ask may be distributed freely without charge, except for a distribution fee
not to exceed $5. No part of its code may be modified.
Ask is Copyright (c) 1988 by Sid Gudes.
Ask was written by:
Sid Gudes
Productivity Improvement Enterprises
Box 11121
Arlington, VA 22210-2121
703/528-1984